<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="../../common/common.jspf"%>
<script type="text/javascript">
	function submitBtn(){
		var chk_value =[];
		$('input[name="checkName"]:checked').each(function(){
		chk_value.push($(this).val());
		});
		var chkLength = chk_value.length;
		if(chkLength==0){
			parent.layer.alert("选择商品分类不能为空!")
			return false;
		}
		if(chkLength>5){
			parent.layer.alert("选择商品分类不能超过5个!")
			window.parent.bottomAlert("选择商品分类不能超过5个!");
			alert('选择商品分类不能超过5个!')
			return false;
		}
//		alert(chk_value.length==0 ?'你还没有选择任何内容！':chk_value); 
		//return false;
		$.ajax({
   			url : "${ctx}/goodsClass/subGoodsClassByApp.do",
   			type : "post",
   		//	dataType : 'json',
   			data : {"chkValue":""+chk_value+""},
   			async : false,
   			success : function(data, status) {
				 parent.layer.msg("操作成功！");
   				 prentClose();
   			},
   			error : function(xhr, status, e) {
   				alert("失败错误信息")
   			//	jQuery.messager.alert('提示:',e,'error'); 
   			}
   		});
	
	}

//关闭当前窗口
function closeBtn(){
	/* var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    parent.layer.close(index); */
    prentClose();
}



</script>

<style type="text/css">
#but button {
	margin-bottom: 5px;
	margin-right: 5px;
}
.col-sm-3 {
	width: 15%;
	float: left;
}

.col-sm-9 {
	width: 30%;
	float: left;
}

label[class^="btn btn-default"] {
	margin-top: -4px;
}
</style>
</head>
	<body>
		<!-- <div class="l_err" style="width: 100%; margin-top: 2px;"></div> -->
			<form id="form" name="form" class="form-horizontal" method="post"
				action="">
			    <section class="panel panel-default">
					<div class="panel-body">
							<c:forEach items="${goodsClass }" var="goods">
									<input type="checkbox" style="margin: 10px 10px 10px 0px;"
										name="checkName" id="name" <c:if test="${goods.status =='1'}">checked="checked"</c:if> value="${goods.id }">${goods.name}
								</c:forEach>
								
								
							<div class="line line-dashed line-lg pull-in"></div>
						
					</div>	
					<footer class="panel-footer text-right bg-light lter">
						<button type="button" onclick="submitBtn();" class="btn btn-success btn-s-xs">提交</button>
						<button type="button" onclick="closeBtn();" class="btn btn-success btn-s-xs">取消</button>
					</footer> 
				</section>
			</form>
	</body>
</html>